import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import HomeSearch from './HomeSearch.jsx';

class SearchWrapper extends Component {
  handleClick = () => {
    this.props.history.push('/city');
  }

  render() {
    return (
      <HomeSearch city={this.props.city.name} onClickCity={this.handleClick}/>
    )
  }
}

export default withRouter(connect(state => ({
  city: state.home.city
}))(SearchWrapper));
